﻿using B.S.Sterilizationcenter.Domain.yjb;
using B.S.Sterilizationcenter.ErrorCode;
using B.S.Sterilizationcenter.Read.API.Appliaction.Commends.yjb;
using MediatR;
using SqlSugar;

namespace B.S.Sterilizationcenter.Read.API.Appliaction.CommandHandlers.yjb
{
    public class FantianResultItemInfosCommandHandlers : IRequestHandler<FantianResultItemInfosCommand, ApiResult<List<ResultItemInfos>>>
    {
        private readonly ISqlSugarClient db;

        public FantianResultItemInfosCommandHandlers(ISqlSugarClient db)
        {
            this.db = db;
        }
        public async Task<ApiResult<List<ResultItemInfos>>> Handle(FantianResultItemInfosCommand request, CancellationToken cancellationToken)
        {
            ApiResult<List<ResultItemInfos>> result = new ApiResult<List<ResultItemInfos>>();
            List<ResultItemInfos> list = db.Queryable<ResultItemInfos>().Where(o => o.ResultItemInfosId == request.ResultItemInfosId).ToList();
            result.Code = ApiEnums.查询成功;
            result.Msg = "查询成功";
            result.Data = list;
            return await Task.FromResult(result);
        }
    }
}
